<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateGoodsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('goods', function (Blueprint $table) {
            $table->bigIncrements('id')->unsigned();


            $table->bigInteger('band_id')->unsigned()->nullable()->comment('品牌id');
            $table->foreign('band_id')->references('id')->on('band');


            $table->string('name')->nullable()->comment('商品名称');
            $table->bigInteger('price')->unsigned()->nullable()->comment('商品价格');
            $table->bigInteger('number')->unsigned()->nullable()->comment('商品数量');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('goods', function ($table) {
            $table->dropForeign(['band_id']);
        });
        Schema::dropIfExists('goods');
    }
}
